/*
 * $Id: file.h,v 1.3 2006-03-22 11:52:32 bacon Exp $
 */

#ifndef _XP_SYS_FILE_H_
#define _XP_SYS_FILE_H_

#include <xp/types.h>
#include <xp/macros.h>

/* flags for xp_openfile */
enum
{
	XP_OPENFILE_READ         = (1 << 0),
	XP_OPENFILE_WRITE        = (1 << 1),
	XP_OPENFILE_CREATE       = (1 << 2),
	XP_OPENFILE_TRUNCATE     = (1 << 3),
	XP_OPENFILE_EXCLUSIVE    = (1 << 4),
	XP_OPENFILE_APPEND       = (1 << 5),
	XP_OPENFILE_NONBLOCK     = (1 << 6),

	/* only for windows */
	XP_OPENFILE_NOSHAREREAD  = (1 << 10),
	XP_OPENFILE_NOSHAREWRITE = (1 << 11)
};

/* access code */
enum
{
	XP_FILE_ACCESS_READ    = 04,
	XP_FILE_ACCESS_WRITE   = 02,
	XP_FILE_ACCESS_EXECUTE = 01,
	XP_FILE_ACCESS_EXIST   = 00
};

/* origin for xp_seekfile */
enum
{
	XP_SEEKFILE_BEGIN   = 0,
	XP_SEEKFILE_CURRENT = 1,
	XP_SEEKFILE_END     = 2
};

/* file handle related operations */


#ifdef __cplusplus
extern "C" {
#endif

xp_file_t xp_openfile (const xp_char_t* path)
xp_closefile (xp_file_t file)
xp_seekfile (xp_file_t file,  )
xp_getfileinfo (xp_file_t file, );

xp_getfileinfo (const xp_char_t* path, xp_fileinfo_t* );
xp_removefile

#ifdef __cplusplus
}
#endif

#endif
